/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 sagyf Yang. The Four Group.
 */

package app.controllers.admin.gift;

import app.models.gift.Exchange;
import com.github.sog.controller.BasicController;
import com.github.sog.controller.datatables.core.DatatablesCriterias;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

/**
 * <p>
 * .
 * </p>
 *
 * @author sagyf yang
 * @version 1.0 2014-06-05 18:34
 * @since JDK 1.6
 */
public class ExchangeController extends BasicController {

    /**
     * The index route.
     */
    public void index() {
        render("index.ftl");
    }


    public void list() {
        final DatatablesCriterias criterias = getCriterias();
        String start_time = getPara("start_time");
        String end_time = getPara("end_time");
        String card_no = getPara("card");
        String gift = getPara("gift");
        final Page<Record> recordPage = Exchange.dao.filterAndList(criterias, start_time, end_time, card_no, gift);
        renderDataTables(recordPage, criterias);
    }
}